package com.song.oa.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.song.oa.entity.R;
import com.song.oa.pojo.Admin;
import com.song.oa.vo.Login;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.servlet.http.HttpServletRequest;
import org.apache.coyote.Request;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author 宋伟宁
 * @Date 2024/3/19
 * @Version 1.0
 **/
@RestController
@Schema(description = "登录接口")
public class LoginController extends  BaseController{


    @PostMapping("/login")
    @Schema(description = "登录接口")
    public R login(@RequestBody Login login, HttpServletRequest request){
        System.err.println("controller....login");
        //登录成功后返回token给前端
         return this.adminService.login(login.getUsername(),login.getPassword(),login.getCode(),request);
    }

    @GetMapping("/test")
    public R login() {
        return new R(200,"测试成功");
    }
}
